package com.yonyou.gmmc.service.pointactivity.constant;

import java.util.Date;
import java.util.HashMap;
import java.util.Map;

import com.yonyou.gmmc.service.pointactivity.util.MD5Encrypt;

/**
 *
 * @author Administrator TODO description
 * @date 2017年4月10日
 */

public class PointActivityConstant {

	public static final String SERVICE_NAME = "pointActivity";
	public static final String SERVICE_NAME_ZH = "三菱积分活动";
	public static final String VERSION = "v1";
	public static final String BASE_PATH = "/" + SERVICE_NAME + "/api";

	public static final String BASE_PACKAGE = "com.yonyou.gmmc.service.pointactivity";
	public static final String UTIL_PACKAGE = BASE_PACKAGE + ".util";
	public static final String DAO_PACKAGE = BASE_PACKAGE + ".dao";
	public static final String MODEL_PACKAGE = BASE_PACKAGE + ".model";

	public static final String HEADER_OPENID = "gmmc.openid";

	public static final String CARINFO_URL = "http://dcmshost/DCMS/common/iclub/IC011/viewVehicleBillDate.json";

	public static final String publickey = "Gmmc_Members_Operation";

	public static final String visitor = "byOfficialWeChat";

	public static final String privatekey = "asldkjfhalkjdrmn34df";

	public static final String slyderAdventuresURL = genSlyderAdventuresURL();

	public static String genSlyderAdventuresURL() {

		String baseURL = "http://gmmc-wechat.bjscfl.com/index.php?g=Interface&m=GmmcMembers&a=integral";

		Map<String, Object> param = new HashMap<String, Object>();

		String timestamp = new Date().getTime() + "";

		param.put("privatekey", privatekey);
		param.put("visitor", visitor);
		param.put("publickey", publickey);
		param.put("timestamp", timestamp);

		param.put("token", MD5Encrypt.MD5Encode(publickey + "&" + timestamp + "&" + privatekey));

		return baseURL + "&" + getUrlParamsByMap(param);
	}
	
	public static final String getOpenInfoUrl = "https://api.weixin.qq.com/cgi-bin/user/info?access_token=ACCESS_TOKEN&openid=OPENID&lang=zh_CN";

	public static String getUrlParamsByMap(Map<String, Object> map) {
		if (map == null) {
			return "";
		}
		StringBuffer sb = new StringBuffer();
		for (Map.Entry<String, Object> entry : map.entrySet()) {
			sb.append(entry.getKey() + "=" + entry.getValue());
			sb.append("&");
		}
		String s = sb.toString();
		if (s.endsWith("&")) {
			s = org.apache.commons.lang.StringUtils.substringBeforeLast(s, "&");
		}
		return "".equals(s) ? "errorGenerateURL=true" : s;
	}

	public static final String INIT_RESULT_TYPE = "INIT_RESULT_TYPE";

	/**
	 * 潜客 状态-10011001-已关注 10011002-取消关注
	 */
	public static final Integer POTENTIAL_USER_STATUS = 10011001;

	public static final Integer USER_TYPE_0 = 100000;// 路人

	public static final Integer USER_TYPE_1 = 100001;// 粉丝

	public static final Integer USER_TYPE_2 = 100002;// 会员

	public static final Integer USER_TYPE_3 = 100003;// 车主

	public static final Integer USER_TYPE_4 = 100004;// 车主但开票时间获取不到

	public static final Integer ACTIVITY_TYPE_0 = 2;// 没有可参加的活动

	public static final Integer ACTIVITY_TYPE_1 = 1;// 销售百万积分

	public static final Integer ACTIVITY_TYPE_2 = 0;// 售后十万积分

	public static final Integer RESULT_MAP_STATUS_00 = 0; // 用户没有存在的奖券

	public static final Integer RESULT_MAP_STATUS_01 = 1; // 用户未认证车主

	public static final Integer RESULT_MAP_STATUS_02 = 2; // 存在有效的奖券

	public static final Integer RESULT_MAP_STATUS_03 = 3; // 存在无效的奖券,已提醒

	public static final Integer RESULT_MAP_STATUS_04 = 4; // 存在无效的奖券,未提醒

	public static final Integer RESULT_MAP_STATUS_05 = 5; // 秒杀活动还没开始

	public static final Integer RESULT_MAP_STATUS_06 = 6; // 秒杀活动已结束

	public static final Integer RESULT_MAP_STATUS_07 = 7; // 去拉萨活动整个已结束

	public static final Integer YES = 10041001; // 是

	public static final Integer NO = 10041002; // 否

	public static final String SYS_CONFIG_KEY_01 = "10011001"; // 去拉萨活动第一场开始时间

	public static final String SYS_CONFIG_KEY_02 = "10011002";// 去拉萨活动第二场开始时间

	public static final String SYS_CONFIG_KEY_03 = "10011003";// 去拉萨活动秒杀持续分钟

	public static final String SYS_CONFIG_KEY_04 = "10011004";// 去拉萨秒杀开始时间

	public static final String SYS_CONFIG_KEY_05 = "10011005";// 去拉萨秒杀结束时间

	public static final String SYS_CONFIG_KEY_06 = "10011006";// 去拉萨活动整体截至时间

	public static final String SYS_CONFIG_KEY_07 = "10011007";// 一年未返厂活动抽奖开始时间

	public static final String SYS_CONFIG_KEY_08 = "10011008";// 一年未返厂活动抽奖结束时间

	// ----------------------一年未返厂活动,返回状态-----------------------------
	public static final String QNE_TITLE = "流失客户调查问卷";

	public static final Integer NOT_RETURN_FACTORY_STATUS_00 = 0; // 不是车主

	public static final Integer NOT_RETURN_FACTORY_STATUS_01 = 1; // 抽奖未开始

	public static final Integer NOT_RETURN_FACTORY_STATUS_02 = 2; // 抽奖已结束

	public static final Integer NOT_RETURN_FACTORY_STATUS_03 = 3; // 不是一年未返厂的车主
	
	public static final Integer NOT_RETURN_FACTORY_STATUS_04 = 4; // 没答题完
	
	public static final Integer NOT_RETURN_FACTORY_STATUS_05 = 5; // 中奖
	
	public static final Integer NOT_RETURN_FACTORY_STATUS_06 = 6; // 未中奖
	
	public static final Integer NOT_RETURN_FACTORY_STATUS_07 = 7; // 未抽奖


	public static final Integer PRIZE_LEVEL_ONE=1;//一等奖
	public static final Integer PRIZE_LEVEL_ONE_POINT=4999;//积分数
	public static final Integer PRIZE_LEVEL_TWO=2;//二等奖
	public static final Integer PRIZE_LEVEL_TWO_POINT=3000;//二等奖积分数
	public static final Integer PRIZE_LEVEL_THREE=3;//三等奖
	public static final Integer PRIZE_LEVEL_THREE_POINT=1000;//三等奖积分数
	public static final String NOT_PRIZE="0";//未中奖
	public static final String HAS_PRIZE="1";//中奖

}
